package org.yellow.backend.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.yellow.backend.pojo.patient;
import org.yellow.backend.service.patientService;

/**
 * @author: hy
 * @create: 2024-01-01
 */
@Slf4j
@RestController
@RequestMapping("/patient")
public class patientController {
    @Autowired
    private patientService service;
    @GetMapping("/{id}")
    public patient getPatient(@PathVariable("id") int id){
        log.info("查询编号为"+id+"的病人");
        return service.selectPatientById(id);
    }

    @PostMapping("/insert")
    public boolean insertPatient( @RequestBody patient patient){
        log.info("添加新的病人信息");
        return service.insertPatient(patient);
    }
}
